<?php

class AjaxAutocomplete {

	public function display(ContextExecution $p_contexte){
		$mode = $p_contexte->m_dataRequest->getData('mode');
		
		switch($mode){
			case 'libelleOperation':
				$numeroCompte = $p_contexte->m_dataRequest->getData('numeroCompte');
				$debLibelle = $p_contexte->m_dataRequest->getData('debLibelle');
				$requete="SELECT distinct operation.libelle FROM operation WHERE operation.nocompte='$numeroCompte' AND libelle LIKE concat('$debLibelle', '%')";
				$listeLibelles = new ListDynamicObject();
		        $listeLibelles->name = 'ListeLibelles';
		        $listeLibelles->request($requete,1);
		        $p_contexte->addDataBlockRow($listeLibelles);
				break;
		}
	}
	
}

?>